package me.zhengjie.modules.service.impl;

import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.domain.Api;
import me.zhengjie.modules.repository.ApiMapper;
import me.zhengjie.modules.service.ApiService;
import org.aspectj.weaver.ast.Var;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("ApiService")
@RequiredArgsConstructor
public class ApiServiceImpl implements ApiService {

    private final ApiMapper apiMapper;

    @Override
    public int saveCreateApi(Api api) {
        return apiMapper.insertApi(api);
    }

    @Override
    public List<Api> queryAllApiByPageForConditions(Map<String, Object> map) {
        return apiMapper.selectAllByPageForConditions(map);
    }

    @Override
    public int saveEditApi(Api api) {
        return apiMapper.updateApiById(api);
    }

    @Override
    public int removeApiById(Api api) {
        return apiMapper.deleteApiById(api);
    }

    @Override
    public Api queryApiById(Long id) {
        return apiMapper.selectApiById(id);
    }

    @Override
    public Api queryApiByVariableName(String VariableName) {
        return apiMapper.selectApiByVariableName(VariableName);
    }

    @Override
    public int queryAllByPageForConditionsToTotal(Map<String, Object> map) {
        return apiMapper.selectAllByPageForConditionsToTotal(map);
    }
}
